<template>
	<el-drawer title="信息详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form :model="form" :rules="rules" ref="dialogForm" label-width="100px" label-position="left">
					<el-form-item label="信息标题">
						{{ form.title }}
					</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="信息类型">
								{{ form.dataTypeName }}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="处理方式">
								{{ form.approvedTypeName }}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="上报部门">
								{{ form.deptName }}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="上报人">
								{{ form.fromUserName }}
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="信息处理人">
								{{ form.approvedUserName }}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="上报时间">
								{{ form.sendTime }}
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="信息内容">
						<div v-html="form.content"></div>
					</el-form-item>
					<el-form-item label="相关附件" prop="attachId">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true"></attach-menu>
					</el-form-item>
					<div v-if="handList.length>0">
						<el-divider>处理结果</el-divider>
						<el-form-item label="处理意见" v-for="item in handList" :key="item.processId">
							{{item.content}}
							<div style="width: 100%;">
								<attach-menu :attachIds="item.attachId" :roleFlag="3" :preview="true"></attach-menu>
							</div>
						</el-form-item>
					</div>

				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>
<script>
import AttachMenu from '@/views/module/attachMenu'

export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu
	},
	data() {
		return {
			visible: false,
			isSaveing: false,
			handList: [],
			form: {
				recordId: '',
				dataTypeName: '',
				approvedTypeName: '',
				approvedUserName: '',
				title: '',
				dataType: '',
				approvedType: '',
				deptId: '',
				deptName: '',
				fromAccountId: '',
				fromUserName: '',
				approvedUser: '',
				sendTime: '',
				toUser: '',
				content: '',
				attachId: '',
				msgType: ''
			},
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open() {
			this.visible = true;
			return this;
		},
		async getDataUploadHandleById() {
			var res = await this.$API.info.uploadData.getDataUploadHandleById.get({recordId: this.form.recordId});
			if (res.code == 200) {
				this.handList = res.data;
			}
		},
		setData(data) {
			this.form.recordId = data.recordId
			this.form.title = data.title
			this.form.dataTypeName = data.dataTypeName
			this.form.approvedTypeName = data.approvedTypeName
			this.form.approvedUserName = data.approvedUserName
			this.form.dataType = data.dataType
			this.form.approvedType = data.approvedType
			this.form.deptId = data.deptId
			this.form.deptName = data.deptName
			this.form.fromAccountId = data.fromAccountId
			this.form.approvedUser = data.approvedUser
			this.form.fromUserName = data.fromUserName
			this.form.sendTime = data.sendTime
			this.form.toUser = data.toUser
			this.form.content = data.content
			this.form.attachId = data.attachId
			this.form.msgType = data.msgType
			this.getDataUploadHandleById();
		},
		async getDataUploadInfoById(data){
			let res = await this.$API.info.uploadData.getDataUploadInfoById.get({recordId:data});
			{
				if(res.code==200)
				{
					this.form.recordId = res.data.recordId
					this.form.title = res.data.title
					this.form.dataTypeName = res.data.dataTypeName
					this.form.approvedTypeName = res.data.approvedTypeName
					this.form.approvedUserName = res.data.approvedUserName
					this.form.dataType = res.data.dataType
					this.form.approvedType = res.data.approvedType
					this.form.deptId = res.data.deptId
					this.form.deptName = res.data.deptName
					this.form.fromAccountId = res.data.fromAccountId
					this.form.approvedUser = res.data.approvedUser
					this.form.fromUserName = res.data.fromUserName
					this.form.sendTime = res.data.sendTime
					this.form.toUser = res.data.toUser
					this.form.content = res.data.content
					this.form.attachId = res.data.attachId
					this.form.msgType = res.data.msgType
					this.getDataUploadHandleById();

				}else
				{
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}
	}
}
</script>

<style>
.customWidth {
	width: 60%;
}
</style>
